
// INCLUDES ********************************************************************

#include "MathUtils.h"

#include <limits.h>



// NAMESPACES ******************************************************************

using namespace Meteor;

// *****************************************************************************

const float MathUtils::DegreeToRadians( const float angle)
{
    return angle * 0.01745329f;
}

// -----------------------------------------------------------------------------

const float MathUtils::RadiansToDegrees( const float angle)
{
    return angle * 57.29578f;
}

// -----------------------------------------------------------------------------

const int MathUtils::NextPowerOfTwo( int n) 
{
    if ( n == 0)
    {
        return 1;
    }
    
    n--;
    
    for ( int i = 1; i < sizeof( int) * CHAR_BIT; i <<= 1)
    {
        n = n | n >> i;
    }
    
    return n + 1;
}
